<?php
// Returns whether or not user is already logged in.
// <auth>
//    <answer>true|false</answer>
//    <admin>true|false</admin>
//    PERHAPS <primaryKey>id</primaryKey> IF A STUDENT LOGS IN
// </auth>

require_once( "db.php" );
  
session_start();
echo "<auth>";

echo "<answer>";
if ( $_SESSION['adminLoggedIn'] == 'true' || $_SESSION['studentLoggedIn'] == 'true' ) {
   echo "true";
}
else {
   echo "false";
}
echo "</answer>";

if ( $_SESSION['studentLoggedIn'] ) {
   echo "<primaryKey>" . $_SESSION['studentId'] . "</primaryKey>";
}

echo "<admin>";
echo ( $_SESSION['adminLoggedIn'] == 'true' ? 'true' : 'false' );
echo "</admin>";

echo "</auth>";

?>